<?php
$csv->addRow($Th_name);
foreach ($td as $t)
{
    $csv->addRow();
    $csv->addField($t['MAvoidanceWord']['id']);
    $csv->addField($t['MAvoidanceWord']['avoidance_word']);
    $csv->addField($t['MAvoidanceWord']['avoidance_word_yomi']);
    $csv->addField($t['MAvoidanceWord']['replace_word']);
    $csv->addField($t['MAvoidanceWord']['replace_word_yomi']);
    $csv->addField($t['MAvoidanceWord']['creator']);
    $csv->addField($t['MAvoidanceWord']['create_time']);
    $csv->addField($t['MAvoidanceWord']['updator']);
    $csv->addField($t['MAvoidanceWord']['update_time']);
    $csv->addField($t['MAvoidanceWord']['invalid_flg']);
    $csv->endRow();
}
    $csv->setFilename($filename);
	echo $csv->render(true,'UTF-8');
?>